package com.qingyun.ipc.impl

import com.qingyun.ipc.ISecurityCenter

class SecurityCenterImpl : ISecurityCenter.Stub() {
    companion object {
        private const val SECURITY_CODE = '^'
    }

    override fun encrypt(content: String?): String? {
        val chars = content?.toCharArray() ?: return null
        chars.forEachIndexed { index, c ->
            chars[index] = (c.code xor SECURITY_CODE.code).toChar()
        }
        return String(chars)
    }

    override fun decrypt(password: String?): String? {
        return encrypt(password)
    }
}